package org.anderground.editor.gui.properties.tunnel;

import org.anderground.core.model.Tunnel;
import org.anderground.editor.edits.Action;
import org.anderground.editor.edits.EditsManager;
import org.anderground.editor.edits.SetTransitionTimeAction;

public class TunnelTimeProperty extends AbstractStringTunnelProperty {

	@Override
	protected String getValue(Tunnel tunnel) {
		return tunnel.getTime() + "";
	}

	@Override
	protected void setValue(Tunnel tunnel, String cellEditorValue) {
		Action act = new SetTransitionTimeAction(tunnel, Integer
				.parseInt(cellEditorValue));
		EditsManager.getInstance().performAction(act);
	}

	@Override
	public String getPropertyName() {
		return "Time";
	}

	@Override
	public boolean isEditable() {
		return true;
	}

}
